<script setup lang="ts">
// 二次封装ElementPlus中的分页器
import { computed } from "vue";
import { useStore } from "@/store";

const store = useStore();
const pageNo = computed(() => store.state.pageNo);
const pageSize = computed(() => store.state.pageSize);
const total = computed(() => store.state.total);
/* eslint-disable */
const emit = defineEmits<{
  (e: "changePage", pageNo: number): void
}>();
function changePage(pageNo: number) {
  emit("changePage", pageNo);
}
</script>

<template>
  <!-- 实现双向绑定v-model:currentPage -->
  <el-pagination
    v-model:currentPage="pageNo"
    :page-size="pageSize"
    :total="total"
    background
    layout="total, prev, pager, next"
    @current-change="changePage"
  ></el-pagination>
</template>

<style scoped lang="scss"></style>
